load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "scplan",
    srcs = [
        "plan.go",
        "plan_explain.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/clusterversion",
        "//pkg/jobs/jobspb",
        "//pkg/sql/schemachanger/scerrors",
        "//pkg/sql/schemachanger/scop",
        "//pkg/sql/schemachanger/scpb",
        "//pkg/sql/schemachanger/scplan/internal/opgen",
        "//pkg/sql/schemachanger/scplan/internal/rules",
        "//pkg/sql/schemachanger/scplan/internal/rules/current",
        "//pkg/sql/schemachanger/scplan/internal/rules/release_24_1",
        "//pkg/sql/schemachanger/scplan/internal/rules/release_24_2",
        "//pkg/sql/schemachanger/scplan/internal/scgraph",
        "//pkg/sql/schemachanger/scplan/internal/scgraphviz",
        "//pkg/sql/schemachanger/scplan/internal/scstage",
        "//pkg/sql/schemachanger/screl",
        "//pkg/sql/sem/catid",
        "//pkg/util",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/timeutil",
        "//pkg/util/treeprinter",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@in_gopkg_yaml_v2//:yaml_v2",
    ],
)

go_test(
    name = "scplan_test",
    size = "large",
    srcs = [
        "main_test.go",
        "plan_test.go",
    ],
    data = glob(["testdata/**"]),
    exec_properties = select({
        "//build/toolchains:is_heavy": {"test.Pool": "large"},
        "//conditions:default": {"test.Pool": "default"},
    }),
    deps = [
        ":scplan",
        "//pkg/base",
        "//pkg/ccl",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/parser",
        "//pkg/sql/schemachanger/scbuild",
        "//pkg/sql/schemachanger/scdeps/sctestutils",
        "//pkg/sql/schemachanger/scerrors",
        "//pkg/sql/schemachanger/scop",
        "//pkg/sql/schemachanger/scpb",
        "//pkg/sql/schemachanger/scplan/internal/scgraph",
        "//pkg/sql/schemachanger/scplan/internal/scgraphviz",
        "//pkg/sql/schemachanger/scplan/internal/scstage",
        "//pkg/sql/schemachanger/screl",
        "//pkg/sql/sem/tree",
        "//pkg/testutils/datapathutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/sqlutils",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/randutil",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_stretchr_testify//require",
        "@in_gopkg_yaml_v2//:yaml_v2",
    ],
)
